package com.topscore.uke.ui;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.topscore.uke.R;
import com.topscore.uke.ui.dialog.LoadingProgressDialog;

/**
 * Created by 71468 on 2017/10/12.
 */

public class BaseSupportFragment extends Fragment {
    private AlertDialog progressDialog;
    protected Context mContext;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mContext = getActivity();
    }

    protected void showProgressDialog(String message) {
        dismissProgressDialog();
        progressDialog = LoadingProgressDialog.showNetDialog(mContext, true, message);
    }

    protected void dismissProgressDialog() {
        if (progressDialog != null && progressDialog.isShowing()) {
            progressDialog.dismiss();
        }
    }

    @Override
    public void startActivity(Intent intent) {
        super.startActivity(intent);
        ((Activity)mContext).overridePendingTransition(R.anim.page_in_left, R.anim.page_out_right);
    }
}
